<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

// Route::middleware('auth:api')->get('/user', function (Request $request) {
//     return $request->user();
// });
Route::group(['namespace' => 'Api','prefix' => 'v1'],function ($router)
{
    $router->post('login','LoginController@login');
    $router->post('logout','LoginController@logout');
    $router->post('token/refresh','LoginController@refresh');
});
//, 'middleware' => 'auth:api'
Route::group(['namespace' => 'Api','prefix' => 'v1'], function($router){
    Route::get('/user', function( Request $request ){
        return response()->json([
            'user' => $request->user('api')
        ],401);
    });
});
